package com.gmail.ceac13;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class FriendOpenHelper extends SQLiteOpenHelper {
			
	 	private static final String DATABASE_NAME = "ConnectDB";
	 	private static final int DATABASE_VERSION = 1;
	 	public  static String INSERCAO = "INSERT INTO Friend (id,nome,email,id_foto,distancia,posicao,ultima_atualizacao) VALUES (?,?,?,?,?,?,?)";
	 	public  static String CLEAR = "DELETE FROM Friend";
 	 	
		FriendOpenHelper(Context context) {
			super(context, DATABASE_NAME, null, DATABASE_VERSION);
		}

		@Override
		public void onCreate(SQLiteDatabase db) {
			String DICTIONARY_TABLE_CREATE ="CREATE TABLE Friend (id text,nome text,id_foto text,email,posicao text,distancia integer,ultima_atualizacao text);";
			db.execSQL(DICTIONARY_TABLE_CREATE);
			
			/*
			 
						
			Object[] bindArgs1 = {1,"Ringo Starr", R.drawable.ringostarr,"200m",};
			db.execSQL(INSERCAO,bindArgs1);
			
			Object[] bindArgs2 = {2,"George Martin", "900m", R.drawable.georgemartin};
			db.execSQL(INSERCAO,bindArgs2 );
			
			Object[] bindArgs3 = {3,"Paul McCartney", "2km", R.drawable.paulmccartney};
			db.execSQL(INSERCAO,bindArgs3 );
			
			Object[] bindArgs4 = {4,"Brian May", "3km", R.drawable.brianmay};
			db.execSQL(INSERCAO,bindArgs4 );
			
			Object[] bindArgs5 = {5,"George Harrison", "4km", R.drawable.georgeharrison};
			db.execSQL(INSERCAO,bindArgs5 );
			
		*/	
			
		}

		@Override
		public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
			db.execSQL("DROP TABLE IF EXISTS DICTIONARY");
			onCreate(db);
		}
		
}
